package com.citsin.atlas.viewmodel

import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.paging.LivePagedListBuilder
import androidx.paging.PagedList
import com.citsin.atlas.bean.Album

/**
 * citsin
 * 2019-06-03
 */


class AlbumViewModel(application: Application):AndroidViewModel(application){
    private val albumList: LiveData<PagedList<Album>>
    init {
        val config = PagedList.Config.Builder()
            .setPageSize(20)
            .setEnablePlaceholders(false)
            .build()
        albumList = LivePagedListBuilder<Int, Album>(
            AlbumDataSourceFactory(application), config).build()
    }

    fun getAlbums():LiveData<PagedList<Album>>{
        return  albumList
    }


}




